import Mock from 'mockjs'

const keepIdList = {
  status: 'success',
  'data|19': [
    {
      KEEPWINE_ID: '@string(32)',
      'audit_STATE|1':[0,1,2]//0-进行中 1-完成 2-失败
    }
  ]
}

const keepList = {
  status: 'success',
  'data|8': [
    {
      KEEPWINE_ID: '@string(32)',
      DATETIME:'@datetime("yyyy-MM-dd HH:mm")',
      KEEPER: '@cname',
      'keeper_DEPARTMENT|1':['营销部','市场部','楼面部','演义部','工程部'],
      actualKeeper_NAME: '@cname',
      actualKeeper_PHONE: '18923523534',
      'STATE|1':[0,1,2,3],//0-检查中 1-存酒中 2-成功 3-失败
      'audit_STATE|1':[0,1,2]//0-进行中 1-完成 2-失败
    }
  ]
}

const keepDetail = {
  status: 'success',
  data: function(){
    let keepDetail = Mock.mock({
      KEEPWINE_ID: '@string(32)',
      ORDER_ID: '@string(32)',
      ORDER_NUMBER:'20181212100'+'@integer(100000000, 999999999)',
      CUSTOMER_NAME: '@cname',
      actualKeeper_NAME: '@cname',
      actualKeeper_PHONE: '18923523534',
      orderUser: {
        'cardApplyers|1':['',[{name:'@cname',phone:'18535434235'},{name:'@cname',phone:'18535434334'}]],
        'subscriber|1':['',{name:'@cname',phone:'18535434233'}],
        'orderCustomer|1':['',{name:'@cname',phone:'18535434132'}],
        'fillingKeeper|1':['',{name:'@cname',phone:'18954566511'}]
      },
      flow: {
        step: 0,
        node:['经理审批','存酒室审批','存酒完成']
      },
      DATETIME:'@datetime("yyyy-MM-dd HH:mm")',
      KEEPER: '@cname',
      'keeper_DEPARTMENT|1':['营销部','市场部','楼面部','演义部','工程部'],
      'ROOM_PLATFORM_TYPE|1': ['散台','卡座','高卡','包厢'],
      'AREA|1':['大厅区','吧台区','包厢区'],
      'NUMBER|1':['A1台','B1台','C1台','M1台','A2台','B2台','C2台','M2台','A3台','B3台','C3台','M3台','1号房'],
      'STATE|1':[0,1,2,3],//0-检查中 1-存酒中 2-成功 3-失败
      'audit_STATE|1':[0,1,2],//0-进行中 1-完成 2-失败
      IS_AUDITOR: '@boolean',
      AUDITOR: '@cname',
      'auditor_DEPARTMENT|1':['营销部','市场部','楼面部','演义部','工程部'],
      'REMARK|1':['','@csentence'],
      'IS_CUSTOMER|1':[0,1],//存酒人是否当前订单的消费者 0-否 1-是
      detailList:[]
    }),keepDetailListItem = null,loop = Mock.Random.integer(1,3)
    for(var j = 0; j < loop; j++){
      let whole = Mock.Random.boolean()?1:0
      let quantity = whole == 1?Mock.Random.integer(1, 10):1
      let scale = whole == 0?Mock.Random.float(5, 15, 1, 1):0
      keepDetailListItem = Mock.mock({
        KEEPWINEDETAILS_ID:'@string(32)',
        NAME:'@ctitle(5,20)',
        EXPIRE_DATETIME:'@datetime("yyyy-MM-dd")',
        'UNIT|1':['支','甁','罐','套','盘'],
        WHOLE:whole,
        QUANTITY:quantity,
        SCALE:scale,
        'IS_CURRENT|1':[0,1],//是否当前台位 1-否 0-是，数据库的是错的
        'PRICE|500-10000.2': 1,
        'STATE|1':[0,1,2]//0-存放中 1-已取出 2-过期
      })
      keepDetail.detailList.push(keepDetailListItem)
    }
    return keepDetail
  }
}

export {keepIdList,keepList,keepDetail}
